#ifndef KITHARA_WIDGET_H
#define KITHARA_WIDGET_H

#include <QToolButton>
#include "user_operation.h"

enum IOValue {
    IO_0 = 0x1,
    IO_1 = 0x2,
    IO_2 = 0x4,
    IO_3 = 0x8,
    IO_4 = 0x10,
    IO_5 = 0x20,
    IO_6 = 0x40,
    IO_7 = 0x80,
    IO_8 = 0x100,
    IO_9 = 0x200,
    IO_A = 0x400,
    IO_B = 0x800,
    IO_C = 0x1000,
    IO_D = 0x2000,
    IO_E = 0x4000,
    IO_F = 0x8000,
};
Q_DECLARE_FLAGS(IOValues, IOValue)

Q_DECLARE_OPERATORS_FOR_FLAGS(IOValues)

QT_BEGIN_NAMESPACE
namespace Ui
{
class KitharaWidget;
}
QT_END_NAMESPACE

class KitharaWidget: public QWidget {
Q_OBJECT

public:
    explicit KitharaWidget(QWidget *parent = nullptr);

    ~KitharaWidget() override;

private:
    // 初始化
    void Init();

    // 信号槽
    void OnConnected();

private Q_SLOTS:

    // 启动设备
    void OnButtonStartClicked();

    // SDO 下发
    void OnButtonSendSDOClicked();

    // 读取 SDO
    void OnButtonReadSDOClicked();

protected:
    void paintEvent(QPaintEvent *event) override;

private:
    Ui::KitharaWidget *ui;
    bool is_running{false};
    KitharaSystemInfo system_info_{};            // Kithara获取的系统信息
};


#endif //KITHARA_WIDGET_H
